package com.fz.service;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

/**
 * Created by webrx on 2017-09-11.
 */

/*@Repository(value = "mylog")
@Service(value = "mylog")        //这四种注解的方式都可以，任选一种都行
@Component(value = "mylog")*/
@Controller(value = "mylog")
@Aspect   //如果aop采用注解的方式就要带上这个
public class Log {

    @Before("execution(public * com.fz.entity..User.save(..))")//如果aop采用注解的方式就要带上这个
    public void open(){
        System.out.println("数据库连接并打开");
    }
    @After("execution(public * com.fz.entity..*.*(..))")//如果aop采用注解的方式就要带上这个
    public void close(){
        System.out.println("数据库关闭");
    }
}
